import request from '../utils/request';

export async function query(params) {
    if (params) {
        return request.get('/api/user', {params});
    } else {
        return request.get('/api/user');
    }
}
export async function queryCheckInfo() {
    return request.get('/api/user/check/check_count');
}
export async function remove(params) {
    return request.post('/api/user/delete', params);
}
export async function status(params) {
    const data = {status: params.status};
    const ids = [];
    params.items.forEach((item) => {
        ids.push(item.id);
    });
    data.ids = ids;
    return request.post('/api/user/status', data);
}

export async function check(params) {
    return request.get('/api/user/check', {params});
}
export async function backUser(params) {
    return request.put(`/api/user/check/${params.id}`);
}
export async function removeUserCheck(params) {
    return request.delete(`/api/user/check/${params.id}`);
}
export async function checkUser(params) {
    return request.post(`/api/user/check/${params.id}`);
}
export async function addUser(params) {
    return request.post('/api/user', params);
}
export async function editUser(params) {
    return request.put(`/api/user/${params.id}`, params);
}
export async function queryProfile(params){
    return request.get(`/api/user/${params.id}`, {params});
}

export async function queryChargeLog(params){
    return request.get(`/api/user/charge`, {params});
}

export async function queryMoneyLog(params){
    return request.get(`/api/user/money`, {params});
}
export async function queryPointLog(params){
    return request.get(`/api/user/point`, {params});
}

export async function queryChangePoint(params){
    return request.post(`/api/user/point/change`, params);
}
export async function queryChangeMoney(params){
    return request.post(`/api/user/money/change`, params);
}
export async function queryFriends(params){
    return request.get(`/api/user/friends`, {params});
}
export async function queryChangeCheckInfo(params){
  return request.get(`/api/user/service/change`, {params});
}
export async function queryChangeServiceCheck(params){
  return request.put(`/api/user/service/change/${params.id}`, params);
}
export async function queryNewServiceCheck(){
  return request.put(`/api/user/service/change/new`);
}
export async function queryCurrent() {
    return request.get('/api/profile');
}
export async function changeShow(params) {
    return request.put('/api/user/index/change',params);
}
